package com.mass.core.sys.authority.controller;

import java.util.List;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.mass.core.sys.authority.services.SysAuthorityServices;
import com.mass.core.sys.menu.model.SysMenu;
import com.mass.core.sys.user.model.SysUser;
import com.mass.core.utils.AjaxResponse;

@RestController
@RequestMapping("/sysAuthority")
public class SysAuthorityController {

	@Autowired
	private SysAuthorityServices sysAuthorityServices;
	
	@RequestMapping("/querySysMenu")
	public AjaxResponse querySysMenuTemp(HttpSession session){
		Object object = session.getAttribute("sysUser");
		if(!ObjectUtils.isEmpty(object)){
			SysUser sysUser = (SysUser) object;
			List<SysMenu> sysMenuList = sysAuthorityServices.querySysMenu(sysUser);
			return AjaxResponse.success("ok", sysMenuList);
		}else{
			return null;
		}
	}
}
